<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>兼职信息工作详情 信息管理</title>
    <meta content="webkit" name="renderer">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <link rel="stylesheet" th:href="@{/layui/css/font.css}">
    <link rel="stylesheet" th:href="@{/layui/css/xadmin.css}">
    <script charset="utf-8" th:src="@{/layui/lib/layui/layui.js}"></script>
    <script th:src="@{/layui/js/xadmin.js}" type="text/javascript"></script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <table class="layui-table layui-form" id="WorkDetailMessage"
                           lay-filter="table">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use([ 'form', 'layer', 'table' ], function() {
        const form = layui.form, table = layui.table, $ = layui.$;
        //执行一个laydate实例
        table.render({
            elem : '#WorkDetailMessage', //指定元素
            url : '/admin_company_work_detail_message_list',
            id : 'list',
            page : {
                layout : [ 'limit', 'count', 'prev', 'page', 'next', 'skip' ],
                groups : 1,
                first : false,
                last : false
            },
            cols : [ [ //表头
                {field : 'requestMessage', title : '岗位要求', width: 350, minWidth : 350, align: "center", sort : true},
                {field : 'duty', title : '岗位职责', width: 350, minWidth : 350, align: "center", sort : true},
                {field : 'salary', title : '薪资待遇', width: 350, minWidth : 350, align: "center", sort : true},
                {field : 'joinMessage', title : '加入须知', width: 350, minWidth : 350, align: "center", sort : true},
                {field : 'contact', title : '联系我们', width: 350, minWidth : 350, align: "center", sort : true},
                {fixed : 'right', title : '操作', toolbar : '#barDemo', align:"center", width : 120}
            ] ]
        });
        //监听行工具事件
        table.on('tool(table)', function(obj){
            switch (obj.event) {
                case 'edit':
                    xadmin.open('修改兼职工作详情信息','/admin_company_work_detail_message_editView?id='+obj.data.id,null,null,false)
                    break;
                case 'del':
                    layer.confirm('真的删除该数据吗?', function(index){
                        $.ajax({
                            url: '/admin_company_work_detail_message_delete?id='+obj.data.id,
                            type: 'post',
                            success: function (res) {
                                if (res.code === 0) {
                                    //弹出提示，并在1秒后进行跳转
                                    layer.alert("删除成功", {
                                        icon : 6
                                    }, function() {
                                        obj.del();
                                        layer.close(index);
                                        location.reload();
                                        return false;
                                    });
                                } else {
                                    layer.msg("删除失败:" + res.msg);
                                    return false;
                                }
                            }
                        })
                    });
                    break;
            }
        });
    });
</script>
<script id="barDemo" type="text/html">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
</body>
</html>